// import util from '/pages/map/index.js'
const app = getApp()
let pageNo = 1;
Page({
  data: {


    orderList: [],
    
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    printOrder: false,
    cancelOrder: false,
    mark:'',


    pageLoad: false,
    orderStatus: {
      WAIT_PAY: '未送货',
      WAIT_TAKE: '送货中',
      FINISHED: '已完成',
      CANCELED: '已取消'
    },
  },

  onLoad: function (options){
    var that=this
    let order = JSON.parse(options.order);
    console.log('-----------')
    console.log(order)
    that.setData({
     orderList: order
    })
    console.log(that.orderList)
  },

  cancelOrder: function(e) {
    var that = this;
    that.setData({
      cancelOrder: true,
    })
    wx.showToast({
      title: '请填写退单原因',
    })
  },
  postOrder: function(e) {
    var that = this;
    wx.showModal({
      title: '提示',
      content: '是否确定已将货物送至收货人手中?',
      success: function(res) {
        if (res.confirm) {
          that.setData({
            printOrder: true,
          })
        } else { //这里是点击了取消以后        
        }
      }
    })




  },
  printOrder: function(e) {
    var that = this
    console.log(that.data.orderList.id)
    wx.request({
      url: app.data.baseUrl + '/transaction/OrderFormMgrAction!deliverSure',
      method: 'get',
      data: {
        'orderForm.id': that.data.orderList.id,
        'orderForm.seller_sure_descr': that.data.orderList.mark
      },
      header: app.globalData.header,
      success: function (res) {
        var rows = res.data.rows;
        console.log('printOrder');
        console.log(res)
        wx.showToast({
          title: '正在打印，请稍等片刻',
        })
        
      },
      fail: function (e) {
        wx.showToast({
          title: '网络异常！',
          duration: 2000
        });
      },})
    
  },
  postCancelOrder: function(e) {
    wx.navigateBack({
      delta: 1,
    })
  },



})